/*****************************************************************************/
/**
*
* @file bsp_usart.h
*
* Header file for bsp_usart.c.
* Target device: STM32F103RET6.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver   Who    Date   	Changes
* ----- ---- ---------- -------------------------------------------------------
* 0.01  abu  02/10/2020 Created
* </pre>
*
*------------------------------------------------------------------------------
* Author:	abu
*					E-mail:	abu_liu@opencores.org
*------------------------------------------------------------------------------
*
******************************************************************************/
#ifndef BSP_USART_H		/* prevent circular inclusions */
#define BSP_USART_H		/* by using protection macros */

#ifdef __cplusplus
	extern "C" {
#endif

/***************************** Include Files *********************************/
#include "stm32f10x.h"
#include "bsp_misc.h"

/************************** Constant Definitions *****************************/
//parameters about debug usart
#define DEBUG_USART	USART1
#define	M6311_USART		USART2

#define Debug_print(str)	USART_SendString(DEBUG_USART,str)
#define M6311_WriteByte(data)	USART_SendByte(M6311_USART,data)
#define M6311_WriteString(str)	USART_SendString(M6311_USART,str)

/************************** Function Declarations ******************************/
void USART1_Init(uint32_t baudrate);
void USART2_Init(uint32_t baudrate);

void USART1_IRQHandler(void);
void USART2_IRQHandler(void);

void USART_SendByte(USART_TypeDef *USARTx, unsigned char data);
void USART_SendString(USART_TypeDef *USARTx, unsigned char *str);
void UsartPrintf(USART_TypeDef *USARTx, char *fmt,...);



#ifdef __cplusplus
}
#endif

#endif
